{% extends "base_generic.html" %}
{% block script %}
<script type="text/javascript">
  function generateUrl(name) {
    var sanitizedName = name;
    sanitizedName = sanitizedName.replace(/ el /gi, ' ');
    sanitizedName = sanitizedName.replace(/ la /gi, ' ');
    sanitizedName = sanitizedName.replace(/ los /gi, ' ');
    sanitizedName = sanitizedName.replace(/ las /gi, ' ');
    sanitizedName = sanitizedName.replace(/ de /gi, ' ');
    sanitizedName = sanitizedName.replace(/ del /gi, ' ');
    sanitizedName = sanitizedName.replace(/ temporada /gi, ' ');
    sanitizedName = sanitizedName.replace(/--/gi, '-');
    sanitizedName = sanitizedName.replace(/---/gi, '-');
    sanitizedName = sanitizedName.replace(/----/gi, '-');
    sanitizedName = string_to_slug(sanitizedName);
    $("#slug").val(sanitizedName);
  }
  $(window).load(
    function() {
      $( "#firstPost" ).datepicker({ dateFormat: 'yy-mm-dd 00:00:00.000000' });
    });
</script>
{% endblock %}
{% block content %}
        <h1>Blog</h1>
        <form action="/admin/blogs/{{ key }}/save/" method="post">
        
        <div class="line">
          <div class="field">
            <label>Name:</label>
            <input id="name" name="name" type="text" size="65" value="{{ name }}" onblur="generateUrl(this.value);" />
          </div>
          <div class="field">
            <label>URL:</label>
            <input id="url" name="url" type="text" size="85" value="{{ url }}" />
          </div>
        </div>
        <div class="line">
          <div class="field">
            <label>Slug:</label>
            <input id="slug" name="slug" type="text" size="50" value="{{ slug }}" />
          </div>
          <div class="field">
            <label>Author:</label>
            <input id="author" name="author" type="text" size="20" value="{{ author }}" />
          </div>
          <div class="field">
            <label>Email:</label>
            <input id="email" name="email" type="text" size="30" value="{{ email }}" />
          </div>
         </div>
         <div class="line">
           <div class="field">
             <label>First post:</label>
             <input id="firstPost" name="firstPost" type="text" size="30" value="{{ firstPost }}" />
           </div>
           <div class="field">
              <label>First month:</label>
              <select name="firstMonth" id="firstMonth">
                <option value="Enero"{% ifequal firstMonth "Enero" %} selected="selected"{% endifequal %}>Enero</option>
                <option value="Febrero"{% ifequal firstMonth "Febrero" %} selected="selected"{% endifequal %}>Febrero</option>
                <option value="Marzo"{% ifequal firstMonth "Marzo" %} selected="selected"{% endifequal %}>Marzo</option>
                <option value="Abril"{% ifequal firstMonth "Abril" %} selected="selected"{% endifequal %}>Abril</option>
                <option value="Mayo"{% ifequal firstMonth "Mayo" %} selected="selected"{% endifequal %}>Mayo</option>
                <option value="Junio"{% ifequal firstMonth "Junio" %} selected="selected"{% endifequal %}>Junio</option>
                <option value="Julio"{% ifequal firstMonth "Julio" %} selected="selected"{% endifequal %}>Julio</option>
                <option value="Agosto"{% ifequal firstMonth "Agosto" %} selected="selected"{% endifequal %}>Agosto</option>
                <option value="Septiembre"{% ifequal firstMonth "Septiembre" %} selected="selected"{% endifequal %}>Septiembre</option>
                <option value="Octubre"{% ifequal firstMonth "Octubre" %} selected="selected"{% endifequal %}>Octubre</option>
                <option value="Noviembre"{% ifequal firstMonth "Noviembre" %} selected="selected"{% endifequal %}>Noviembre</option>
                <option value="Diciembre"{% ifequal firstMonth "Diciembre" %} selected="selected"{% endifequal %}>Diciembre</option>
              </select>
            </div>
            <div class="field">
               <label>First Year:</label>
               <input id="firstYear" name="firstYear" type="text" size="4" value="{{ firstYear }}" />
             </div>
         </div>
        <div class="line">
           <div class="field">
             <label>Country:</label>
             <input id="country" name="country" type="text" size="40" value="{{ country }}" />
           </div>
           <div class="field">
             <label>Twitter:</label>
             <input id="twitter" name="twitter" type="text" size="30" value="{{ twitter }}" />
           </div>
          </div>
         <div class="line">
           <div class="field">
             <label>Description:</label>
             <textarea cols="90" rows="12" id="description" name="description">{{ description }}</textarea>
           </div>
        </div>
        <input type="hidden" name="codenum" id="codenum" value="{{ filekey }}" />
        <input type="submit" value="Guardar" id="save" name="save" name="save" /><br class="clear" />
      </form>
      <br class="clear" />

{% endblock %}
      